/*
package com.github.niefy.modules.wx.testController;

import com.github.niefy.common.utils.CookieUtil;
import com.github.niefy.common.utils.MD5Util;
import com.github.niefy.common.utils.R;
import com.github.niefy.modules.wx.entity.WxUser;
import com.github.niefy.modules.wx.form.WxH5OuthrizeForm;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.bean.WxOAuth2UserInfo;
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

*/
/**
 * @author : [86188]
 * @description : [一句话描述该类的功能]
 * @createTime : [2022/8/30 16:38]
 * @updateUser : [86188]
 * @updateTime : [2022/8/30 16:38]
 *//*


@Slf4j
@Controller
@RequestMapping("/test/thirdLogin/inner")
@Tag(name = "测试功能用接口")
public class thirdLoginInnerController {

    @Autowired
    private WxMpService wxMpService;

    @GetMapping("/login")
    @Operation(summary = "第三方登录绑定-微信内",description = "用于微信内第三方登录授权页面回调")
    public R codeToUserInfo(HttpServletRequest request, HttpServletResponse response,
                             @RequestParam(value = "code") String code) {
        try {
            //this.wxMpService.switchoverTo(appid);
            WxOAuth2AccessToken token = wxMpService.getOAuth2Service().getAccessToken(code);
            //可作为场景值，具体
            //String state = form.getState();
            WxOAuth2UserInfo userInfo = wxMpService.getOAuth2Service().getUserInfo(token,"zh_CN");
            String openid = userInfo.getOpenid();
            CookieUtil.setCookie(response, "openid", openid, 365 * 24 * 60 * 60);
            String openidToken = MD5Util.getMd5AndSalt(openid);
            CookieUtil.setCookie(response, "openidToken", openidToken, 365 * 24 * 60 * 60);
            return R.ok();
        } catch (WxErrorException e) {
            log.error("code换取用户信息失败", e);
            return R.error(e.getError().getErrorMsg());
        }
    }
}
*/
